<?php
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header ("Cache-Control: no-cache, must-revalidate");
     header ("Pragma: no-cache");
     header("content-type: application/x-javascript; charset=tis-620");
     include_once('connection/connection.php');
     $data=$_GET['data'];
     $val=$_GET['val'];
	 
	 if($data=='district')
	 {		
         	echo "&nbsp;<select name='district' id='district' style='height:19px; width:145px; font-family: Verdana; font-size: 8.5pt;' onChange=\"changesubmit('show',this.value)\" >\n
         	<option value='0'>=====district====</option>\n";
         	$val2=$val;
         	$val = substr($val,0,10);                            
         	$result=mysql_query("select DISTINCT district_id, district_name from tbl_lookup_location order by district_name");
         	while(list($id, $name)=mysql_fetch_array($result))
		  	{
			echo $id;
			echo $name;
              echo "<option value=\"$id\">$name</option> \n" ;
         	} 	
	  }
	  echo "</select>";
	  
	 if($data=='show')
	 {		
	echo "<input type='button' value='submit' id='submit' name='submit' onClick=\"view('showDiv','$val')\" style='font-size: 9pt; font-family: Verdana; border: 1px solid #808080' />";
	 }
	 
	 if($data=='showDiv')
	 {	
	?> 
	<table width='686' border='1' cellspacing='0' cellpadding='0' bordercolor='#C5D8EB' style='border: 1px solid #BBD1E8'>";
			<tr align='center' bgcolor='#6699CC' height='30'><td colspan='5'  bordercolor='#C5D8EB' style='border: 1px solid #BBD1E8'><font face='Verdana' style='font-size: 9.5pt'><b>Water Quality Report</b></font></td></tr>";
			  <tr><td width="81"><font face="Verdana" style="font-size: 8pt" color="#000000">Sr.No.</font></td>
			<td width="81"><font face="Verdana" style="font-size: 8pt" color="#000000">Date
</font></td>
			<td width="64"><font face="Verdana" style="font-size: 8pt" color="#000000">Block Name
</font></td>
			<td width="62"><font face="Verdana" style="font-size: 8pt" color="#000000">Panchayat Name
</font></td>
			<td width="68"><font face="Verdana" style="font-size: 8pt" color="#000000">Village Name
</font></td>
			<td width="75"><font face="Verdana" style="font-size: 8pt" color="#000000">Habitation Name
</font></td>
			<td width="54"><font face="Verdana" style="font-size: 8pt" color="#000000">Habitation Type
</font></td>
			<td width="50"><font face="Verdana" style="font-size: 8pt" color="#000000">Source Type
</font></td>
			<td width="47"><font face="Verdana" style="font-size: 8pt" color="#000000">Location
</font></td>
			<td width="35"><font face="Verdana" style="font-size: 8pt" color="#000000">Functional Status
</font></td>
			<td width="30"><font face="Verdana" style="font-size: 8pt" color="#000000">Para pH
</font></td>
			<td width="30"><font face="Verdana" style="font-size: 8pt" color="#000000">Para tds
</font></td>
			<td width="30"><font face="Verdana" style="font-size: 8pt" color="#000000">Para clorine
</font></td>
			<td width="30"><font face="Verdana" style="font-size: 8pt" color="#000000">Para fluorine
</font></td>
			<td width="30"><font face="Verdana" style="font-size: 8pt" color="#000000">Para no3
</font></td>
			<td width="28"><font face="Verdana" style="font-size: 8pt" color="#000000">Bactriology
</font></td>
		</tr>
		<?php
			  
			  $i=1;
		$querystring="SELECT date,l.block_name,l.panchayat_name,l.village_name,l.habitation_name,detail.type_habit,source_type,location,functional_status,para_ph,para_tds,para_cl,para_f,para_no3,bact from tbl_dtls_q3_loc loc,tbl_dtls_q3_water_source_detail detail,tbl_lookup_location l where loc.district_id=".$distId." and loc.id=detail.loc_id and l.district_id=loc.district_id and l.block_id=loc.block_id and l.panchayat_id=loc.panchayat_id and l.village_id=loc.village_id and l.habitation_name=detail.habitation_name";
  $result=mysql_query($querystring);
  while($data=mysql_fetch_array($result))
  {
			 ?> 
			 <td width="81"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $i++;?></font></td>
			<td width="81"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['date'];?></font></td>
			<td width="64"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['block_name'];?></font></td>
			<td width="62"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['panchayat_name'];?></font></td>
			<td width="68"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['village_name'];?></font></td>
			<td width="75"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['habitation_name'];?></font></td>
			<td width="54"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['type_habit'];?></font></td>
			<td width="50"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['source_type'];?></font></td>
			<td width="47"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['location'];?></font></td>
			<td width="35"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['functional_status'];?></font></td>
			<td width="30"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['para_ph'];?></font></td>
			<td width="30"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['para_tds'];?></font></td>
			<td width="30"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['para_cl'];?></font></td>
			<td width="30"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['para_f'];?></font></td>
			<td width="30"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['para_no3'];?></font></td>
			<td width="28"><font face="Verdana" style="font-size: 8pt" color="#000000"><?php echo $data['bact'];?></font></td>
		</tr>
		<?php
			$i++; 
			  }?>
			 
		</table>
			 
	 <?php }
	 ?>







?>